package com.ms.education;

import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * <p>Project:education-GetLocalIpAndPortUtil
 * <p>Powered by ms on 2023-02-17 03:44:20
 *
 * @author ms
 * @version 1.0
 * @since 1.8
 */
@Component
public class ServerUtils implements InitializingBean {
    @Value("${server.port}")
    private int serverPort;

    public static Integer SERVER_PORT;

    public static String SERVER_IP;

    public static String SERVER_IP_PORT;

    @Override
    public void afterPropertiesSet() throws Exception {
        SERVER_PORT=serverPort;
        SERVER_IP=InetAddress.getLocalHost().getHostAddress();
        SERVER_IP_PORT=SERVER_IP+":"+SERVER_PORT;
    }
}
